package cn.iocoder.yudao.module.call.dal.mysql.cmacstask;


import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.call.controller.admin.cmacstaskphone.vo.CmAcsTaskPhonePageReqVO;
import cn.iocoder.yudao.module.call.dal.dataobject.cmacstask.CmAcsTaskPhoneDO;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.ibatis.annotations.Mapper;

/**
 * 外呼任务号码明细 Mapper
 *
 * @author 数创万维
 */
@Mapper
@DS("cm")
public interface CmAcsTaskPhoneMapper extends BaseMapperX<CmAcsTaskPhoneDO> {

    default PageResult<CmAcsTaskPhoneDO> selectPage(CmAcsTaskPhonePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CmAcsTaskPhoneDO>()
                .eqIfPresent(CmAcsTaskPhoneDO::getAcsTask, reqVO.getAcsTask())
                .eqIfPresent(CmAcsTaskPhoneDO::getTelephone, reqVO.getTelephone())
                .eqIfPresent(CmAcsTaskPhoneDO::getStatus, reqVO.getStatus())
                .eqIfPresent(CmAcsTaskPhoneDO::getPriority, reqVO.getPriority())
                .betweenIfPresent(CmAcsTaskPhoneDO::getCtime, reqVO.getCtime())
                .orderByDesc(CmAcsTaskPhoneDO::getId));
    }

    default Long selectCount(CmAcsTaskPhonePageReqVO reqVO) {
        return selectCount(new LambdaQueryWrapperX<CmAcsTaskPhoneDO>()
                .eqIfPresent(CmAcsTaskPhoneDO::getAcsTask, reqVO.getAcsTask())
                .eqIfPresent(CmAcsTaskPhoneDO::getTelephone, reqVO.getTelephone())
                .eqIfPresent(CmAcsTaskPhoneDO::getStatus, reqVO.getStatus())
                .eqIfPresent(CmAcsTaskPhoneDO::getPriority, reqVO.getPriority())
                .betweenIfPresent(CmAcsTaskPhoneDO::getCtime, reqVO.getCtime())
                .orderByDesc(CmAcsTaskPhoneDO::getId));
    }
}